/*
 * Copyright (c) 2024 Black Sesame Technologies
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _DAL_ALLOCATOR_H_
#define _DAL_ALLOCATOR_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>

#include "dal/domain_participant.h"
#include "dal/topic.h"
#include "dal/publisher.h"
#include "dal/subscriber.h"

// common
void* dal_allocate(size_t size);
void dal_free(void* ptr);

// entity
dal_domain_participant_t* dal_domain_participant_allocate();
void dal_domain_participant_free(dal_domain_participant_t* ptr);

dal_topic_t* dal_topic_allocate();
void dal_topic_free(dal_topic_t* ptr);

dal_publisher_t* dal_publisher_allocate();
void dal_publisher_free(dal_publisher_t* ptr);

dal_subscriber_t* dal_subscriber_allocate();
void dal_subscriber_free(dal_subscriber_t* ptr);

dal_datawriter_t* dal_datawriter_allocate();
void dal_datawriter_free(dal_datawriter_t* ptr);

dal_datareader_t* dal_datareader_allocate();
void dal_datareader_free(dal_datareader_t* ptr);

dal_service_t* dal_service_allocate();
void dal_service_free(dal_service_t* ptr);

dal_client_t* dal_client_allocate();
void dal_client_free(dal_client_t* ptr);

// listener
dal_domain_participant_listener_t* dal_domain_participant_listener_allocate();
void dal_domain_participant_listener_free(dal_domain_participant_listener_t* ptr);

dal_topic_listener_t* dal_topic_listener_allocate();
void dal_topic_listener_free(dal_topic_listener_t* ptr);

dal_publisher_listener_t* dal_publisher_listener_allocate();
void dal_publisher_listener_free(dal_publisher_listener_t* ptr);

dal_subscriber_listener_t* dal_subscriber_listener_allocate();
void dal_subscriber_listener_free(dal_subscriber_listener_t* ptr);

dal_datawriter_listener_t* dal_datawriter_listener_allocate();
void dal_datawriter_listener_free(dal_datawriter_listener_t* ptr);

dal_datareader_listener_t* dal_datareader_listener_allocate();
void dal_datareader_listener_free(dal_datareader_listener_t* ptr);

// qos
dal_domain_participant_qos_t* dal_domain_participant_qos_allocate();
void dal_domain_participant_qos_free(dal_domain_participant_qos_t* ptr);

dal_topic_qos_t* dal_topic_qos_allocate();
void dal_topic_qos_free(dal_topic_qos_t* ptr);

dal_publisher_qos_t* dal_publisher_qos_allocate();
void dal_publisher_qos_free(dal_publisher_qos_t* ptr);

dal_subscriber_qos_t* dal_subscriber_qos_allocate();
void dal_subscriber_qos_free(dal_subscriber_qos_t* ptr);

dal_datawriter_qos_t* dal_datawriter_qos_allocate();
void dal_datawriter_qos_free(dal_datawriter_qos_t* ptr);

dal_datareader_qos_t* dal_datareader_qos_allocate();
void dal_datareader_qos_free(dal_datareader_qos_t* ptr);

// type support
dal_type_support_t* dal_type_support_allocate();
void dal_type_support_free(dal_type_support_t* ts);

#ifdef __cplusplus
}
#endif

#endif  // _DAL_ALLOCATOR_H_
